#-Desc: java代码md自动生成模块
#-Author: fxl0206

ifeq ("$(MARKDOWN_OUT)", "")
build:
	@echo "MARKDOWN_OUT not set ,you can use make build -e MARKDOWN_OUT=/xx/xxx" 
	@exit 1
else	
setX:
	@chmod +x ${roleHome}/jmd_render.sh
main: setX
	@echo "# demo-springboot-app" > ${MARKDOWN_OUT}

pom: 
	@echo "" >> ${MARKDOWN_OUT}
	@echo "## pom.xml" >> ${MARKDOWN_OUT}
	@echo "" >> ${MARKDOWN_OUT}
	@echo "\`\`\` xml">> ${MARKDOWN_OUT}
	@cat ${CURDIR}/pom.xml >>${MARKDOWN_OUT}
	@echo "" >> ${MARKDOWN_OUT}
	@echo "\`\`\`" >> ${MARKDOWN_OUT}

config: 
	@echo "" >> ${MARKDOWN_OUT}
	@echo "## 配置文件" >> ${MARKDOWN_OUT}
	@${roleHome}/jmd_render.sh ./src/main/resources ${MARKDOWN_OUT}
	
code: 
	@echo "" >> ${MARKDOWN_OUT}
	@echo "## 源码" >> ${MARKDOWN_OUT}
	@${roleHome}/jmd_render.sh ./src/main/java ${MARKDOWN_OUT}

testConfig: 
	@echo "" >> ${MARKDOWN_OUT}
	@echo "## 测试配置" >> ${MARKDOWN_OUT}
	@${roleHome}/jmd_render.sh ./src/test/resources ${MARKDOWN_OUT}

testCode: 
	@echo "" >> ${MARKDOWN_OUT}
	@echo "## 测试代码" >> ${MARKDOWN_OUT}
	@${roleHome}/jmd_render.sh ./src/test/java ${MARKDOWN_OUT}



build: main pom config code testConfig testCode #构建当前工程为markdown #MARKDOWN_OUT=?
	@echo build ok,save file to ${MARKDOWN_OUT}

endif